package cate.common.table.herodirectbuy.sheet;

import cate.common.table.ESheet;
import cate.common.table.herodirectbuy.row.HeroDirectBuyPoolRow;
import cate.common.table.item.favorability.row.FavorabilityAttrRow;
import cate.common.util.random.RWList;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class HeroDirectBuyPoolSheet extends ESheet<HeroDirectBuyPoolRow> {
    @Override
    public String getSheetName() {
        return "英雄直购奖励池";
    }

    public HeroDirectBuyPoolRow randomPool(){
        List<HeroDirectBuyPoolRow> rows = getList().stream().
                filter(e -> e.getWeight() > 0).collect(Collectors.toList());
        if (rows.isEmpty()) {
            return null;
        }
        RWList<HeroDirectBuyPoolRow> rwList = new RWList<>();
        rwList.addAll(rows);
        return rwList.setup().get();
    }
}
